package com.atguigu.chaptar3

object $03_Extends {
  class Person{
    private val name = "lisi"
    var age = 20
    val address = "shenzhen"
    def add(x:Int,y:Int)=x+y
  }
  class Student extends Person{
    override val address = "beijing"
    override def add(x:Int,y:Int)={
      val k=x*y
      super.add(k,y)
    }
  }

  def main(args: Array[String]): Unit = {
    val p1 = new Person
    val s = new Student
    println(s.add(3, 5))
    println(s.address)
    val p:Person= new Student
    println(p.add(3, 5))
  }

}
